﻿// JScript 文件
function fillPersonManager()
{
    document.getElementById("right").innerHTML="";
        document.getElementById("right").innerHTML="<div>"
        +"<table width='760' border='0' align='center' cellpadding='0' cellspacing='0'>"
        +"<tr><td style='height: 183px'>"
        +"<table width='200' height='30' border='0' cellpadding='0' cellspacing='0'>"
        +"<tr><td style='font-size: 14px'>权限管理&gt;&gt;用户管理</td>"
        +"</tr></table>"
        +"<table width='760' border='0' cellspacing='0' cellpadding='0'>"
        +"<tr>"
        +"<td width='1520' height='8' colspan='2' background='images/line.gif'>"
        +"</td></tr></table>"
        +"<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
        +"<tr>"
        +"<td style='width: 580px; height: 35px'>&nbsp;"
        +"<input name='radiobutton' type='radio' value='radiobutton' checked='checked' />个人用户"
        +"<input name='radiobutton' type='radio' value='radiobutton' onclick='MoveTo()' />企业用户"
        +"&nbsp; &nbsp; 查询方式：<select id='condition' style='width: 71px'>"
        +"<option selected='selected' value=0>用户名</option>"
        +"<option   value=1>姓名</option></select>"
        +"<input id='keyword' type='text' style='width: 100px' />&nbsp;"
        +"<input id='btFi2' type='button' value='查 询' style='width: 58px' language='javascript' onclick='return btFi2_onclick()' />"
        +"<input id='btFi3' type='button' value='全 部' language='javascript' onclick='return btFi3_onclick()' /></td>"
        +"<td align='right' style='height: 35px; text-align: left;'>&nbsp;"
        +"<a href='#' onclick='AddNew()'><u>新增</u></a>&nbsp;&nbsp;"
        +"<a href='#' onclick='Edit()'><u>编辑</u></a>&nbsp;&nbsp;<a href='#'><u onclick='Delete()'>删除</u></a>&nbsp;&nbsp;"
        +"<a href='#'><u onclick='userGetLayer()'>分配图层</u></a></td>"
        +"</tr></table>"
        +"<div id='content'>"
        +"<table id='tb_user' width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#C6D0DF'>"
        +"<tr id='top'>"
        +"<td width='100' align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>用户名</td>"
        +"<td align='center' bgcolor='#E2E7ED' class='title1' style='width: 150px; height: 28px'>姓名</td>"
        +"<td width='80' align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>性别</td>"
        +"<td align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>身份证号</td>"
        +"<td width='100' align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>联系电话</td>"
        +"<td width='120' align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>"
        +"<label>操作</label></td>"
        +"<td width='80' align='center' bgcolor='#E2E7ED' class='title1' style='height: 28px'>"
        +"<label>选择</label></td></tr></table></div>"
        +"<div id='pageinfo'>&nbsp;&nbsp到第"
        +"<input id='pagenum' type='text' style='width: 20px; height: 12px;' />页&nbsp;&nbsp;"
        +"<input id='go' type='button' value='确定' onclick='showPage()' style='cursor: pointer; height: 20px;' />"
        +"</div>"
        +"<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
        +"<tr>"
        +"<td align='left' style='height: 30px'>"
        +"<p align='left'>&nbsp;</p></td></tr></table></td></tr></table></div>";
}

function btFi2_onclick() 
    {
        act=2;
        ShowList();
    }
    
    function btFi3_onclick() {
        act=0;
        ShowList();
    }
    
    function ShowList()
    {  
        //init();
        var res=Default2.GetList(g_Page,g_PageSize,act,condition,keyword,orderby).value;
        var tblHtml = "";
        if(orderby==0)
            tmphtm='<span id="img_usercode" onclick="changepic(0)" style="cursor:hand"><img src="../../img/new/down.gif" alt="点击按用户名降序排列"/></span>';
        else
            tmphtm='<span id="img_usercode" onclick="changepic(1)" style="cursor:hand"><img src="../../img/new/up.gif" alt="点击按用户名升序排列"/></span>';

        if(res)
        {
            tblHtml+='<table id="tb_user" width="100%" cellpadding="0" cellspacing="0" style="border-right: royalblue 1px solid; border-top: royalblue 1px solid; border-left: royalblue 1px solid; border-bottom:royalblue 1px solid; border-collapse: collapse;"><tr id="top">';
            tblHtml+='<td width="80" align="center" bgcolor="CornflowerBlue" class="title1" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><label><font color="white">选择</font></label></td>';
            tblHtml+='<td align="center" bgcolor="CornflowerBlue" class="title1" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><font color="white">用户名'+tmphtm+'</font></td>';
            tblHtml+='<td align="center" bgcolor="CornflowerBlue" class="title1" style="width: 150px; height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><font color="white">姓名</font></td>';
            tblHtml+='<td width="80" align="center" bgcolor="CornflowerBlue" class="title1" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><font color="white">性别</font></td>';
            tblHtml+='<td align="center" bgcolor="CornflowerBlue" class="title1" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><font color="white">联系电话</font></td>';
            tblHtml+='<td align="center" bgcolor="CornflowerBlue" class="title1" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><font color="white">角色</font></td></tr>';

            //res是服务器返回的一个List<MyClass>集合
            for(var i=0;i<res.length;i++)
            {  
                if(i%2==0)
                {
                    if(i==g_index)
                    tblHtml+='<tr><td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><input id='+res[i].Userid+' onclick=setIndex('+i+') name="selec" checked type="radio" /></td>';
                    else
                    tblHtml+='<tr><td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><input id='+res[i].Userid+' onclick=setIndex('+i+') name="selec" type="radio" /></td>';
                    tblHtml+='<td align="center" bgcolor="#EFF3FB" style="cursor:hand;height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><a style=cursor:pointer;color=blue;text-decoration:underline; onclick=Look('+res[i].Userid+')>'+res[i].Name+'</a></td>';
                    tblHtml+='<td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Truename+'</td>';
                    tblHtml+='<td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Sex+'</td>';
                    tblHtml+='<td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Telphone+'</td>';
                    tblHtml+='<td align="center" bgcolor="#EFF3FB" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Title+'</td>';
                }
                else
                {
                 if(i==g_index)
                    tblHtml+='<tr><td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><input id='+res[i].Userid+' onclick=setIndex('+i+') name="selec" checked type="radio" /></td>';
                else
                    tblHtml+='<tr><td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><input id='+res[i].Userid+' onclick=setIndex('+i+') name="selec" type="radio" /></td>';
                    tblHtml+='<td align="center" bgcolor="#FFFFFF" style="cursor:hand;height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;"><a style=cursor:pointer;color=blue;text-decoration:underline; onclick=Look('+res[i].Userid+')>'+res[i].Name+'</a></td>';
                    tblHtml+='<td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Truename+'</td>';
                    tblHtml+='<td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Sex+'</td>';
                    tblHtml+='<td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Telphone+'</td>';
                    tblHtml+='<td align="center" bgcolor="#FFFFFF" style="height: 28px;border-right: royalblue 1px solid; border-bottom: royalblue 1px solid; border-collapse: collapse;">'+res[i].Title+'</td>';
                }
            }
        }
        tblHtml+='</tr></table>';
        $("content").innerHTML=tblHtml;
        $("pageinfo").innerHTML='<center>'+ pagemanage.GetPaginationHtml(totalcount,5,"showPage")+'</center>';
    }